<template>
  <el-dialog title="工单处理" :visible.sync="dialogVisible" width="500px">
    <el-form :model="form">
      <el-form-item label="内容：" :label-width="formLabelWidth">
        <el-input
          type="textarea"
          v-model="form.content"
          autocomplete="off"
          :rows="3"
          placeholder="请输入备注信息！例如：商家已向用户赔偿"
        ></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">关闭</el-button>
      <el-button type="primary" @click="submit">确认处理</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { intervene } from '@/api/complaint'
export default {
  props: ["suggestId"],
  data() {
    return {
      dialogVisible: false,
      formLabelWidth: "120px",
      form: {
        content: "",
      },
    };
  },
  methods: {
    close(){
      this.dialogVisible = false;
      this.form = {
        content: "",
      }
    },
    submit() {
      if (!this.form.content) {
        this.$message.warning("请输入备注信息");
        return false;
      }
      intervene({
        suggest_id: this.suggestId,
        content: this.form.content
      }).then(res =>{
        this.close()
        this.$parent.getList();
      })
    },
  },
};
</script>

<style lang="scss" scoped>
</style>